package com.longjianghuasheng.logistics.business.main

import android.content.Intent
import android.os.Bundle
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.base.BaseActivity
import com.longjianghuasheng.logistics.databinding.ActivityWelcomeBinding
import com.longjianghuasheng.logistics.util.CacheUtil
import com.longjianghuasheng.logistics.util.SettingUtil
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

/**
 * 作者　: hegaojian
 * 时间　: 2020/2/22
 * 描述　:
 */
@Suppress("DEPRECATED_IDENTITY_EQUALS")
class WelcomeActivity : BaseActivity<BaseViewModel, ActivityWelcomeBinding>() {


    override fun layoutId() = R.layout.activity_welcome

    override fun initView(savedInstanceState: Bundle?) {
        //防止出现按Home键回到桌面时，再次点击重新进入该界面bug
        if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT !== 0) {
            finish()
            return
        }
        mDatabind.welcomeBaseview.setBackgroundColor(SettingUtil.getColor(this))



        mDatabind.welcomeImage.postDelayed({

            startActivity(
                Intent(
                    this@WelcomeActivity,
                    /*  if (CacheUtil.isFirst) GuideActivity::class.java else*/
                    MainActivity::class.java
                )
            )


            finish()
            //带点渐变动画
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
        }, 300)
    }


}